export const calcAngle = ([start, end], map, defaultAg = 0) => {
  let ag = defaultAg;
  if (map) {
    const p_start = map.lngLatToContainer(start), p_end = map.lngLatToContainer(end);
    const diff_x = p_end.x - p_start.x, diff_y = p_end.y - p_start.y;
    ag = 360 * Math.atan2(diff_y, diff_x) / (2 * Math.PI);
  }
  return ag;
};

export const calcDistance = ([start, end], map) => {
  return map.GeometryUtil.distance(start, end);
};
